import org.junit.Test;

/**
 * @author ypz
 * @date 2021/9/14 10:17
 */
public class SuperKnow {
    protected String name = "father";

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public SuperKnow(String name) {
        this.name = name;
        System.out.println(name);//1、调用父类构造函数打印 zhangsan
    }

    public SuperKnow() {
    }
}
class SubSuperKnow extends SuperKnow{
    private String name = "children";

    /**
     *
     * @param name
     * @param name1
     */
     public SubSuperKnow(String name,String name1){
         //1、直接引用父类的构造函数
         super(name);
         this.name = name1;
         super.name = name1;
     }

     public  void test(){
         //2、当父类中的成员和子类中的成员重名时，用super区分
         System.out.println(super.name);//2、调用父类成员，父类成员被重新赋值 lisi
         System.out.println(this.name);//3、调用子类成员，lisi
     }

}

